import { defineStore } from 'pinia'
import { ref } from 'vue'

function memberStore() {
  /** 会员信息 */
  const profile = ref<any>()

  /** 登录，保存会员信息 */
  const setProfile = (val: any) => {
    profile.value = val
  }

  /** 退出，清理会员信息 */
  const clearProfile = () => {
    profile.value = undefined
  }

  return {
    profile,
    setProfile,
    clearProfile,
  }
}

export const useMemberStore = defineStore('member', memberStore, {
  persist: true,
})
